package com.teamwork.ZuccEcho.Service.impl;

import com.teamwork.ZuccEcho.Entity.Student;
import com.teamwork.ZuccEcho.Entity.Teacher;
import com.teamwork.ZuccEcho.Repository.LoginStuApiRepository;
import com.teamwork.ZuccEcho.Service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class StudentServiceImpl implements StudentService {
    @Autowired
    private LoginStuApiRepository loginStuApiRepository;

    @Override
    public List<Student> getStudentList() {
        return loginStuApiRepository.findAll();
    }



    public boolean login(String s_id,String password){
               Iterable<Student> students = loginStuApiRepository.findAll();
               for (Student s:
                            students) {
                       if(s.getStu_id().equals(s_id) && s.getStu_pwd().equals(password)){
                                return true;
                            }
                    }
               return false;
           }
}
